<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCompanyContractTable extends Migration{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up(){
        /*  企业合同记录表 company_contract */
        Schema::create('company_contract', function (Blueprint $table) {
            $table->engine = 'MyISAM';
            $table->increments('id')->unsigned()->comment('自增长主键');
            $table->integer('uid')->index('uid')->nullable()->comment('所属用户uid');
            $table->tinyInteger('category')->unsigned()->default(0)->comment('购买类型');
            $table->tinyInteger('refill_type')->unsigned()->default(0)->comment('提前续费(1代表提前续费)');
            $table->timestamp('start_time')->nullable()->comment('开始时间');
            $table->timestamp('end_time')->nullable()->comment('结束时间');
            $table->mediumInteger('vip_resume_number')->unsigned()->default(0)->comment('会员期内简历数');
            $table->mediumInteger('vip_integral')->unsigned()->default(0)->comment('会员期内积分');
            $table->mediumInteger('vip_post_number')->unsigned()->default(0)->comment('会员期内职位数');
            $table->mediumInteger('resume_number')->unsigned()->default(0)->comment('非会员简历数');
            $table->mediumInteger('integral')->unsigned()->default(0)->comment('非会员积分');
            $table->integer('responsible_crm_uid')->index('responsible_crm_uid')->nullable()->comment('销售负责人id');
            $table->string('responsible',60)->default('')->comment('销售负责人');
            $table->decimal('money',8,2)->default('0.00')->comment('金额');
            $table->tinyInteger('pay')->unsigned()->default(0)->comment('支付方式');
            $table->timestamp('pay_time')->nullable()->comment('支付时间');
            $table->text('remark')->default('')->comment('备注');
            $table->integer('admin_uid')->index('admin_uid')->nullable()->comment('开通人(0代表自助开通)');
            $table->integer('order_id')->index('order_id')->unique()->unsigned()->nullable()->comment('定单关联ID');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down(){
        Schema::drop('company_contract');
    }
}
